#include <iostream>
#include <string>

int main() {
    std::string a;
    std::cin >> a;
    int b = 0, c = 0, d = 0;
    if (a == "[]{}()" || a == "[](){}" || a == "{}()[]" || a == "{}[]()" || a == "()[]{}" || a == "(){}[]") {
        std::cout << "True" << std::endl;
    } else if (a.length() == 8) {
        for (int i = 0; i < a.length() - 5; ++i) {
            if (a[i] == '{' && (a[i + 1] == '}' || a[i + 3] == '}' || a[i + 5] == '}')) {
                b++;
            } else if (a[i] == '[' && (a[i + 1] == ']' || a[i + 3] == ']' || a[i + 5] == ']')) {
                c++;
            } else if (a[i] == '(' && (a[i + 1] == ')' || a[i + 3] == ')' || a[i + 5] == ')')) {
                d++;
            } else if (a[i] == '<' && (a[i + 1] == '>' || a[i + 3] == '>' || a[i + 5] == '>')) {
                d++;
            }
        }
        if (b + c + d == 3) {
            std::cout << "True" << std::endl;
        } else {
            std::cout << "False" << std::endl;
        }
    } else if (a.length() == 6) {
        for (int i = 0; i < a.length() - 3; ++i) {
            if (a[i] == '{' && (a[i + 1] == '}' || a[i + 3] == '}')) {
                b++;
            } else if (a[i] == '[' && (a[i + 1] == ']' || a[i + 3] == ']')) {
                c++;
            } else if (a[i] == '(' && (a[i + 1] == ')' || a[i + 3] == ')')) {
                d++;
            }
        }
        if (b + c + d == 3) {
            std::cout << "True" << std::endl;
        } else {
            std::cout << "False" << std::endl;
        }
    } else if (a.length() == 4) {
        if (a[0] == '[' && (a[1] == ']' || a[3] == ']')) {
            c++;
        }
        if (a[1] == '(' && a[2] == ')') {
            d++;
        }
        if (c + d == 2) {
            std::cout << "True" << std::endl;
        } else {
            std::cout << "False" << std::endl;
        }
    } else if (a.length() == 2) {
        if (a[0] == '(' && a[1] == ')') {
            d++;
        }
        if (d == 1) {
            std::cout << "True" << std::endl;
        } else {
            std::cout << "False" << std::endl;
        }
    } else {
        std::cout << "False" << std::endl;
    }
    return 0;
}